<?php
class code_parents {
	//private $funStr;
	private $CI;
	function __construct() {
		$CI = & get_instance ();
		$this->CI = $CI;
		$CI->load->helper ( 'url' );
	
	}
	function getBaseUrl($url = '') {
		//return $url;
		$CI = & get_instance ();
		$CI->load->helper ( 'url' );
		return $CI->config->base_url ( $url );
	}
	function getUserIcon($userIcon,$default='/assets/images/grzy_01.gif'){
	
		return $this->getBaseUrl( empty ( $userIcon ) ? $default : $userIcon);
	}
	function getRreplayDivs($id, $type, $divType='Replay') {
		
		$CI 			= & get_instance ();
		$CI->load->model ( "team_model" );
		$divCode 		= "";
		$tableData		= $CI->team_model->queryDynamicReplyByID ( $id, $type );
		log_message("info","tableData".json_encode($tableData));
		$funStr			= "get".$divType."Tag";	
		foreach ( $tableData as $row ) {
			log_message("info","row  ==  ".$row);
			$divCode .=  $this->$funStr($row);
		}
		log_message ( "info", "replay content==>" . $divCode );
		return $divCode;
	}
	private function getReplayTag($data) {
		extract ( $data );
		$imgPath = $this->getBaseUrl ( "assets/$headIcon" );
		$createTime = date ( 'Y年m月d日  H:i', strtotime ( $reply_time ) );
		$divCode = "<div class='tdzy_rgd2 tdContent'> ";
		$divCode .= "<div class='rgd2_d1'></div>";
		$divCode .= "<div class='rgd2_d2'>";
		$divCode .= "<div class='sead2_1'><img src='$imgPath' width='62' height='62' /></div>";
		$divCode .= "<div class='sead2_2 tdzy_rig2'>";
		$divCode .= "<p class='sead2_p1'>回复人：$nickName</p>";
		$divCode .= "<p class='sead2_p2'>$reply_content</p>";
		$divCode .= "<p class='sead2_p3'></p>";
		$divCode .= "<p class='sead2_p4 tdzy_rip2'>";
		$divCode .= "<span><a style='consor:pointer;' class='dynamic_reply'><strong class='sead2_stg5'>$createTime</strong></a></span>";
		$divCode .= "</p>";
		$divCode .= "</div>	";
		$divCode .= "</div>";
		$divCode .= "<div class='rgd2_d3'></div>";
		$divCode .= "</div>";
		return $divCode;
	}
	private function getPreviewReplayTag($data) {
		extract ( $data );
		$headIcon	  = $this->getBaseUrl ( "assets/$headIcon" );
		$createTime	  = date('Y年m月d日',strtotime($createTime));
		$divCode  	  = "<div>";
		$divCode 	 .= "<img src='images/search_07.gif'  width='62' height='62' style='margin-top:10px; float:left;'/>";
		$divCode  	 .= "<div class='images_pl_bg'>";
		$divCode 	 .= "<p><span>$nickName：</span>$reply_content</p>";
		//$divCode .= "<a href='#'>回复</a><a href='#'>删除</a>";
		$divCode 	 .= "<p style='text-align:right; margin-top:-10px; margin-right:5px;'>$createTime</p>";
		$divCode 	 .= "</div>";
		$divCode 	 .= "</div>";
		return $divCode;
	
	}
	function getMoreClick() {
		return '<div class="moreFoot"><a style="cursor:pointer" page="1" class="showMore">更多&lt;&lt;&lt; </a></div>';
	}

}
